<template>
  <div class="scroll-loadmore">
      <section class="inner">
      <slot></slot>
      <footer class="load-more">
          <span @click="onLoad">{{loadingText}}</span>
      </footer>
    </section>
  </div>
</template>

<script>

export default {
  name: 'LoadMore',
  props: {
    loadingText: {
      type: String,
    },
    hasMore: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      startY: 0,
      startScroll: 0,
      infiniteLoading: false,
    };
  },
  methods: {
    onLoad() {
      if (this.hasMore) {
        this.$store.state.loadMore = true;
      } else {
        this.$store.state.loadMore = false;
      }
    },
  },
  components: {
  },
};
</script>

<style scoped>
  .scroll-loadmore {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    -webkit-overflow-scrolling: touch;
    background-color: #FFF;
  }

  .scroll-loadmore .inner {
    top: 0;
    width: 90%;
    transition-duration: 300ms;
  }

  .scroll-loadmore .load-more {
    height: 1rem;
    font-size: 0.5rem;
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #FFF;
  }
</style>
